package com.sise.wangzhan.client;

import com.netflix.config.ConfigurationManager;
import com.sise.wangzhan.command.ThreadCommand;

/**
 * @Classname ThreadCommandClient
 * @Description TODO    使用线程隔离策略，配置线程池大小为3，进行6次循环，有3次命令将会触发回退
 * @Date 2020/4/30 10:11
 * @Created by wangzhan
 */
public class ThreadCommandClient {
    public static void main(String[] args) throws InterruptedException {
        //配置线程大小为3
        ConfigurationManager.getConfigInstance().setProperty(
                "hystrix.threadpool.default.coreSize", 3
        );

        for (int i = 1; i <= 6; i++) {
            ThreadCommand tc = new ThreadCommand(i);
            tc.queue();
        }
        Thread.sleep(5000);
    }
}
